package com.hgy.chapter2.service;

import java.util.List;
import java.util.Map;

import com.hgy.chapter2.helper.DatabaseHelper;
import com.hgy.chapter2.model.Customer;

public class CustomerService {

	public List<Customer> getCustomerList() {

		String sql = "SELECT * FROM tb_customer";
		return DatabaseHelper.queryEntityList(Customer.class, sql);
	}

	public Customer getCustomer(Long id) {
		// TODO
		return null;
	}

	public boolean createCustomer(Map<String, Object> fieldMap) {

		return DatabaseHelper.insertEntity(fieldMap);

	}

	public boolean updateCustomer(Long id, Map<String, Object> fieldMap) {

		return DatabaseHelper.updateEntity(id, fieldMap);

	}

	public boolean deleteCustomer(Long id) {

		return DatabaseHelper.deleteEntity(id);

	}

}
